package com.liveneo.adapter.mobile.service.impl;

import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.liveneo.adapter.base.entity.PrpmLossMain;
import com.liveneo.adapter.base.mapper.PrpmLossMainMapper;
import com.liveneo.adapter.mobile.service.LossMainService;

@Service
public class LossMainServiceImpl implements LossMainService {
    @Autowired
    private PrpmLossMainMapper prpmLossMainMapper;

    @Override
    public int saveLossMain(PrpmLossMain lossMain) throws Exception {
        return prpmLossMainMapper.insert(lossMain);
    }

    @Override
    public int deleteLossMain(String caseNo) throws Exception {
        return prpmLossMainMapper.deleteByRegistNo(caseNo);
    }

    @Override
    public PrpmLossMain getLossMain(String caseNo) {
        return prpmLossMainMapper.selectByRegistNo(caseNo);
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    @Override
    public PrpmLossMain getLossMainByCaseNoLossID(String caseNo, String lossID) throws Exception {
        Map params = new HashMap();
        params.put("registNo", caseNo);
        params.put("lossID", lossID);
        return prpmLossMainMapper.selectByRegistNoLossID(params);
    }

    @Override
    public PrpmLossMain getprpmLossMain(String lossUuid) throws Exception {
        return prpmLossMainMapper.selectByLossUuid(lossUuid);
    }

    @Override
    public int deleteprpmLossMain(String lossUuid) throws Exception {
        return prpmLossMainMapper.deleteByLossUuid(lossUuid);
    }
}
